package spil;

import desktop_resources.GUI;

public class Jail extends Field {
	private static final int PRISON_POSITION = 11;
	private static final int POLICE_POSITION = 31;
	
	public Jail(int fieldNumber) {
		super(fieldNumber);
	}
	
	public static void jail(Player p) {
		p.jail();
		p.moveToField(PRISON_POSITION);
	}
	
	public void landOnField(Player p) {
		if(p.getPosition() == POLICE_POSITION)
			jail(p);
		else if(p.getJailed()) {
			if(p.getJailTime() < 3) {
				p.jailTime();
				if(p.getJailCard())
					p.getOutOfJail();
				else GUI.getUserButtonPressed(p + "er i fængsel", "ok");
			} else p.getOutOfJail();
		}
	}
}
